/**
 *    Copyright 2006-2017 the original author or authors.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package org.mybatis.generator.plugins.custome;


public class BaseJson {

    public BaseJson() {
    }

    public BaseJson(Boolean hasError, String code, String msg) {
        super();
        this.hasError = hasError;
        this.code = code;
        this.msg = msg;
    }

    public BaseJson(Boolean hasError, String msg) {
        this.hasError = hasError;
        this.msg = msg;
    }

    public BaseJson(String errroMessage) {
        this.hasError = Boolean.TRUE;
        this.msg = errroMessage;
    }

    /**
     * 是否有错
     */
    private Boolean hasError = false;
    /**
     * code=500时表示当前请求的操作出错了 需要转到当前操作失败页0表示成功
     */
    private String code = "0";

    /**
     * 有错为错误信息，没错为成功提示信息
     */
    private String msg;

    public Boolean getHasError() {
        return hasError;
    }

    public void setHasError(Boolean hasError) {
        this.hasError = hasError;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void setErrorMessage(String errorMessage) {
        this.msg = errorMessage;
        this.hasError = Boolean.TRUE;
        this.code = ResponseCode.ERROR;
    }
}
